﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CMS6Tools.Management
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            //var dictionary = new Dictionary<string, List<string>>();
            //var index =0;
            //var servers = new string[] { @"Z:\Projects on Titan", @"Z:\Projects on Adarna" };
            //foreach (var server in servers)
            //{
            //    var cityFolders = Directory.GetDirectories(server, "*,*");
            //    foreach (var cityFolder in cityFolders)
            //    {
            //        Console.WriteLine(string.Format("{0} - Checking {1}", index++, cityFolder));
            //        var site6ProjectFolder = Path.Combine(cityFolder, @"Site6\Project");

            //        var path = Path.Combine(site6ProjectFolder, "CMS6");
            //        if (Directory.Exists(path))
            //        {
            //            var existingIoCInCMS6CustomFolders = Directory.GetFiles(path, "*.ioc", SearchOption.AllDirectories);
            //            var existingIoCInComponentsCustomFolders = Directory.GetFiles(Path.Combine(site6ProjectFolder, "Components"), "*.ioc", SearchOption.AllDirectories);
            //            var iocFiles = existingIoCInCMS6CustomFolders.Concat(existingIoCInComponentsCustomFolders).ToList();
            //            if (iocFiles.Any())
            //                dictionary[cityFolder] = iocFiles;
            //        }
            //    }
            //}

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //var destination = @"D:\test.xlsx"; 

            //var exeFolder = Path.GetDirectoryName(Application.ExecutablePath);
            //var template = Path.Combine(exeFolder, @"Data\CodeChangeTemplate.xlsx");
            //using (var excel = new OpenXmlExcel(destination, template))
            //{
            //    // Title
            //    excel.UpdateValue("CodeChange", "A1", "Title");
            //    excel.UpdateValue("CodeChange", "B1", "Description");
            //    excel.UpdateValue("CodeChange", "C1", "Project Type");
            //    excel.UpdateValue("CodeChange", "D1", "Changeset Type");
            //    excel.UpdateValue("CodeChange", "E1", "Added Files");
            //    excel.UpdateValue("CodeChange", "F1", "Changed Files");
            //    excel.UpdateValue("CodeChange", "G1", "Deleted Files");

            //    // Content
            //    excel.UpdateValue("CodeChange", "A2", "TEST Title");
            //    excel.UpdateValue("CodeChange", "B2", "TEST Description");
            //    excel.UpdateValue("CodeChange", "C2", "TEST Project Type");
            //    excel.UpdateValue("CodeChange", "D2", "TEST Changeset Type");
            //    excel.UpdateValue("CodeChange", "E2", "TEST Added Files");
            //    excel.UpdateValue("CodeChange", "F2", "TEST Changed Files");
            //    excel.UpdateValue("CodeChange", "G2", "TEST Deleted Files");
            //}


            Application.Run(new MainForm());
        }
    }
}
